package com.yike.user.controller;

import com.yike.user.param.AlipayTransferParam;
import com.yike.user.service.CommissionSettleService;
import com.yike.user.utils.AlipayTransferUtil;
import lombok.extern.slf4j.Slf4j;
import com.yike.common.base.BaseController;
import com.yike.common.api.ApiResult;
import com.yike.common.log.Module;
import com.yike.common.log.OperationLog;
import com.yike.common.enums.OperationLogType;
import org.springframework.validation.annotation.Validated;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * 代理商分佣结算表 控制器
 *
 * @author Sakura
 * @since 2024-09-09
 */
@Slf4j
@RestController
@RequestMapping("/commissionSettle")
@Module("user")
@Api(value = "代理商分佣结算API", tags = {"代理商分佣结算"})
@ApiIgnore
public class CommissionSettleController extends BaseController {

    @Autowired
    private CommissionSettleService commissionSettleService;
    @Autowired
    private AlipayTransferUtil alipayTransferUtil;

    @PostMapping("/transfer")
    @OperationLog(name = "支付宝转账", type = OperationLogType.ADD)
    @ApiOperation(value = "支付宝转账", response = ApiResult.class)
    public ApiResult<Boolean> transfer(@Validated @RequestBody AlipayTransferParam alipayTransferParam) throws Exception {
        alipayTransferUtil.transfer(alipayTransferParam.getOutBizNo(),
                alipayTransferParam.getTransAmount(), alipayTransferParam.getLoginId(),
                alipayTransferParam.getUserName(), alipayTransferParam.getOrderTitle());
        return ApiResult.result(true);
    }

}

